package com.magina.productor.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.magina.basic.api.SysLogService;
import com.magina.basic.model.SysLog;
import com.magina.productor.mapper.SysLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassnName :com.magina.common.test.TestController
 * @Author： Magina.Hu
 * @Date： 2019/4/22
 * @Description：
 * @Version: V1.0
 * Copyright (c) 2019-2020 .All rights reserved.
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private SysLogService sysLogService;

    @Autowired
    private SysLogMapper sysLogMapper;

    @GetMapping("/testDubboService")
    public Object testDubboService(){
        return sysLogService.findList();
    }

    @GetMapping("/testMybatisPlusApi")
    public void testMybatisPlusApi(){
        Page<SysLog> page = new Page<>(1, 3);
        QueryWrapper<SysLog> wrapper = new QueryWrapper<>();
        //条件
        List<SysLog> sysLogList = this.sysLogMapper.selectList(wrapper);
        //分页
        IPage<SysLog> sysLogIPage = this.sysLogMapper.selectPage(page, wrapper);
        //主键Id
        SysLog sysLog = new SysLog();
        sysLog.setClassName("test");
//        sysLogMapper.insert(sysLog);
        System.out.println("qwe");
    }


}
